package cn.zebra.dev.product.module.comment.service.impl;

import cn.zebra.dev.ibatis.plus.service.impl.ServiceImpl;
import cn.zebra.dev.ibatis.plus.utils.PageUtils;
import cn.zebra.dev.ibatis.plus.utils.Query;
import cn.zebra.dev.product.module.comment.dao.ProductCommentAppendDao;
import cn.zebra.dev.product.module.comment.entity.ProductCommentAppendEntity;
import cn.zebra.dev.product.module.comment.service.ProductCommentAppendService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 
 *
 * @author runnable
 */
@Service
public class ProductCommentAppendServiceImpl extends ServiceImpl<ProductCommentAppendDao, ProductCommentAppendEntity> implements ProductCommentAppendService {



    @Override
    public PageUtils<ProductCommentAppendEntity> findPage(Map<String, Object> params) {
        QueryWrapper<ProductCommentAppendEntity> wrapper = new QueryWrapper<>();
        IPage<ProductCommentAppendEntity> page = this.page(
                new Query<ProductCommentAppendEntity>(params).getPage(),
                wrapper
        );
        return new PageUtils<>(page);
    }

    @Override
    public List<ProductCommentAppendEntity> findByIds(List<Long> productCommentIds) {
        QueryWrapper<ProductCommentAppendEntity> wrapper = new QueryWrapper<>();
        wrapper.in("product_comment_id", productCommentIds);
        return list(wrapper);
    }
}
